<template>
  <!-- 商家入驻 -->
  <div class="background">
    <img :src="imgSrc"/>
  </div>
  <div class="content">
    <van-field v-model="nickname" label="名称" placeholder="请输入名称" />
    <van-field
      v-model="password"
      type="password"
      label="密码"
      placeholder="请输入密码"
    />
    <van-field v-model="mobile" label="手机号" placeholder="请输入手机号" />
    <van-field
      v-model="address"
      label="店铺地址"
      placeholder="请输入店铺地址"
    />
    <van-button type="primary" @click="submit">入驻</van-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      nickname: "",
      password: "",
      address: "",
      mobile: "",
      // 背景图片
      imgSrc: require("../assets/1.png"),
    };
  },
  methods: {
    submit: function () {
      if (this.nickname == "") {
        this.$toast.fail("昵称不能为空");
        return false;
      }
      if (this.password == "") {
        this.$toast.fail("个性签名不能为空");
        return false;
      }
      if (this.address == "") {
        this.$toast.fail("地址不能为空");
        return false;
      }
      if (this.mobile == "") {
        this.$toast.fail("联系方式不能为空");
        return false;
      }
      this.myaxios(this.weburl + "shops/register/", "post", {
        nickname: this.nickname,
        password: this.password,
        address: this.address,
        mobile: this.mobile,
      }).then((data) => {
        console.log("data", data);
        if (data.code == 200) {
          this.$toast.success(data.msg);
        } else {
          this.$toast.fail(data.msg);
        }
      });
    },
  },
  created() {},
};
</script>

<style scoped>
@import url("../assets/style.css");
.background {
  width: 100%;
  height: 100%; /**宽高100%是为了图片铺满屏幕 **/
  z-index: -1;
  position: absolute;
}
 .content {
    z-index:1;
    position: absolute;
}
</style>